﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EIS.DataAccess;
using System.Drawing;
using System.Data;
using System.Web.UI.DataVisualization.Charting;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.Web;
using System.Json;
using System.Web.Script.Serialization;
using Module;
using System.Data.OracleClient;
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Chart1.Width = 600;
        Chart1.Height = 400;
        Chart1.Titles.Add("用水性质统计");
        Chart1.BackColor = Color.FromArgb(223, 223, 223);

        DataTable dt = new DataTable();
        //string sql = "select sum(fd_nov) as num,decode(t.fd_fgsbh,'01','城东','02','城南','03','城西','04','城北') as fd_fgsbh from tb_statics_khglms t group by fd_fgsbh";
        string sql = "select sum(fd_nov) as num,t.FD_KHGLMC from tb_statics_khglms t group by FD_KHGLMC";

        dt = OraHelper.ReturnDataSet(CommandType.Text, sql, null).Tables[0];//第一种绑定方式
        Chart1.DataSource = dt;
        Chart1.Series[0].XValueMember = "FD_KHGLMC";
        Chart1.Series[0].YValueMembers = "NUM";
        
        //OracleDataReader reader = OraHelper.ExecuteReader(CommandType.Text, sql, null);
        //Chart1.Series[0].Points.DataBind(reader, "FD_KHGLMC", "NUM", "");//第二种绑定方式

        //Chart1.Series[0].ToolTip = "#VALX:#VALY";
        //Chart1.Series[0].LegendToolTip = "#PERCENT";
        //Chart1.Series[0].PostBackValue = "#INDEX";
        //Chart1.Series["Series1"].MarkerColor = Color.Purple;
        //Chart1.Series["Series1"].ChartType = SeriesChartType.Pie;
       // Chart1.Legends.Add("leg");
        Chart1.Legends[0].Enabled = true;
      
        Chart1.Legends["leg"].ForeColor = Color.Red;
        Chart1.Legends["leg"].Docking = Docking.Right;
        Chart1.Legends["leg"].Alignment = StringAlignment.Center;
        Chart1.Legends["leg"].BackColor = Color.Transparent;

        //Chart1.ChartAreas[0].Area3DStyle.Enable3D = true;
        
        
        //Chart1.DataBind();
        //ReportDocument myReport = new ReportDocument();
        //string reportPath = Server.MapPath("~/app_data/crystalreport1.rpt");

        JavaScriptSerializer json = new JavaScriptSerializer();
        AcceptOdd odd = new AcceptOdd();
        odd.Acceptoddseq = "1111111";
        odd.Contactphone = "phone number";
        //odd.Customname = "张三";
        odd.Customno = "02132";
        odd.Linkman = "李四";
        odd.Registeraddr = "东塘";
        odd.Subcompany = "城东";
        odd.Watermetercode = "6543210";
        string jsonString = json.Serialize(odd);
        lblJsonString.Text = jsonString;
        
        
    }
    protected void Chart1_Click(object sender, ImageMapEventArgs e)
    {
        int pointIndex = int.Parse(e.PostBackValue);
        Series series = Chart1.Series[0];
        if (pointIndex >= 0 && pointIndex < series.Points.Count)
        { series.Points[pointIndex].CustomProperties += "Exploded=true"; } 

    }
}
